package zuoye07;

import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;

public class zuoye06 {
       public static void main(String[] args) throws IOException {
        //  FileReader fr=new FileReader("a");
          //String a=fr.readline();
          //System.out.println(a);

        try {
            FileReader fr = new FileReader("a");

            int ch = 0;
            String a = "";
            while ((ch = fr.read()) != -1) {
//			System.out.println(ch);
                a += (char) ch;
            }
            System.out.println(a);
            String[] aa = new String[a.split("-").length];
            for (int i = 0; i < a.split("-").length; i++) {
                aa[i] = a.split("-")[i];
            }
            Arrays.sort(aa);
            StringBuilder ll = new StringBuilder();
            for (String s : aa) {
                if(s==aa[aa.length-1])
                {
                    ll.append(s);
                    break;
                }
                ll.append(s).append('-');

            }

            System.out.println(ll);
            FileWriter ww= new FileWriter("a");
            ww.write(ll.toString());
            ww.close();
        }
        catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        catch (NullPointerException e) {
            System.out.println("空指针");
            throw new NullPointerException();
        }
        }

}
